// 校验手机号是否正确
export const validatorMobile = (rule: any, value: string | number, callback: any) => {
    value = typeof value === "number" ? value.toString() : value
    const pattern = /^1[3-9]\d{9}$/
    if (["", null, undefined].includes(value) || pattern.test(value)) {
        callback()
    } else {
        callback(new Error("请输入正确的手机号"))
    }
}

// 校验身份证号是否正确
export const validatorIDCard = (rule: any, value: string, callback: any) => {
    const pattern = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))((0[1-9])|(1\d)|(2[0-9])|(3[01]))\d{3}(\d|X|x)$/
    if (["", null, undefined].includes(value) || pattern.test(value)) {
        callback()
    } else {
        callback(new Error("请输入正确的身份证号"))
    }
}